'''
__new__的作用：在__init__方法执行之前就执行开始，类进行实例化对象前执行的方法就是__new__

'''


class MyString(str):
    def __new__(cls, *args, sep='|'):
        print(cls)
        s = ''
        for v in args:
            s += v + sep
        # print(s)
        index=-len(sep)
        print(index)
        return str.__new__(cls,s[:index])
    def __init__(self,*args,sep='|'):
        # print(*args)
        pass
ms=MyString('a','b','c',sep=',')
print(ms)
a='a,b,c,'
print(a[:-1])